<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateCarTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('car', function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->string('number', 20)->comment('车牌号');
            $table->enum('plate_colour', [1, 2, 3])->default(1)->comment('车牌颜色:1-蓝色，2-绿色，3-黄色');
            $table->string('restriction')->default(0)->comment('限行:0-不限行，1-7分别表示星期一至星期日');
            $table->enum('ownership', [1, 2])->nullable()->default(1)->comment('所属权：1-个人，2-公司');
            $table->bigInteger('company_id')->index()->comment('所属公司');
            $table->string('type')->nullable()->comment('业务类型');
            $table->integer('people')->default(5)->comment('载客人数');
            $table->string('vin', 50)->nullable()->comment('车架号');
            $table->bigInteger('front')->nullable()->comment('车辆照片');
            $table->bigInteger('side')->nullable()->comment('车辆侧面');
            $table->bigInteger('back')->nullable()->comment('车辆背面');
            $table->integer('brand_id')->nullable()->comment('车辆品牌ID');
            $table->string('model')->nullable()->comment('车辆型号');
            $table->string('colour')->nullable()->comment('车辆颜色');
            $table->enum('status', [1, 2, 3, 4, 5, 6])->default(3)->comment('车辆状态:1-正常，2-报废，3-未完善，4-冻结，5-待审核，6-驳回');
            $table->enum('outward_status', [0, 1])->default(0)->comment('出车状态状态:0-未出车，1-出车中');
            $table->bigInteger('outward_dr_id')->nullable()->comment('出车司机ID');
            $table->timestamps();
            $table->softDeletes();
        });
        \DB::statement("ALTER TABLE `car` comment '车辆表'");
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('car');
    }
}
